import pageEmitter from '@/common/mitt/page'

export function useKeep() {
  onBeforeRouteLeave((to, from, next) => {
    if (to.meta?.isPage) {
      pageEmitter.emit('addLog')
    }
    next()
  })
  onActivated(() => {
    pageEmitter.emit('rollback')
  })
}
